#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>


int main()
{
  char message[] = "I am a good student";
  int fd = open("./1.txt",O_RDWR | O_CREAT,0644);
  if(fd < 0)
  {
    fprintf(stderr,"./1.txt is open fail\n");
    return -1;
  }
  write(fd,message,strlen(message));
  lseek(fd,0,SEEK_SET);
  char ch,n;
  while((n = read(fd,&ch,1))!= 0)
  {
    write(STDOUT_FILENO,&ch,n);
  }
  printf("\n");
  close(fd);

  return 0;
}
